<template>
  <div>
    <span class="title">{{title}}</span>
    <span class="text">{{text}}</span>
  </div>
</template>

<script setup>
import {qyGetUserInfo} from 'src/plugins/http/server/qy';
import { showLoading,msgFn } from 'src/utils';
import env from 'src/config';

const title = ref('BI报表')
const text = ref('授权登录。。。')
const { path } = env;
const router = useRouter();
const route = useRoute();
const {userId,corpid,secret,name} = route.query;

const apps = [
  {
    name:'BI报表',
    getHref(userNo){
      const query = {
        userNo,
        appkey:'4D48433768345243625A4145316F6B2F396D50534243655A7444592B41774C7636566552645231627464616D714B566A4E51364C464C50646D47674A564B6755'
      }
      return `https://main.hsh.com.cn/api/finereport/frBilogin?${UtilTools.queryString(query)}`
    }
  },
  {
    name:'测试',
    getHref(userNo){
      const query = {
        userNo,
        appkey:'4D48433768345243625A4145316F6B2F396D50534243655A7444592B41774C7636566552645231627464616D714B566A4E51364C464C50646D47674A564B6755'
      }
      return `https://www.baidu.com?${UtilTools.queryString(query)}`
    }
  }
]

if(userId && corpid && secret){
  title.value = name;
  qyGetUserInfo({data:{
    userId,corpid,secret
  }}).then(rs=>{
    // text.value = JSON.stringify(rs)
    const current = apps.find(e=>e.name === name);
    const href = current.getHref(userId);
    window.open(href,'_self')
  })
}else{
  text.value="非法请求"
}



</script>

<style scoped lang="less">
@import 'index';
</style>
